package org.micro_gzm.v5.loaders.fbx;

import org.micro_gzm.v5.core.GZMMaterial;
import org.micro_gzm.v5.math.Vector3D;
import org.micro_gzm.v5.utils.ColorRGB;

import android.util.Log;

public class FBXMaterial extends FBXLoader implements GZMMaterial {
	
	public static final String NAME = "Material";
	
	public String ID;
	public String className;
	public String type;
	
	public String shadingModel;
	public ColorRGB ambientColor;
	public ColorRGB diffuseColor;
	public double diffuseFactor;
	public double transparencyFactor;
	public Vector3D emissive;
	public Vector3D ambient;
	public Vector3D diffuse;
	public double opacity;	
	
	private String fbxMaterialData;
	
	public FBXMaterial() {
		
	}
	
	public FBXMaterial(String dataIn) {
		
		fbxMaterialData = "Material: " + dataIn;
		
		initialize();
	}
	
	private void initialize() {

		String[] attrData = getBlockAttributes(fbxMaterialData, " Material: ");
		ID =  attrData[0];
		className =  attrData[1];
		type =  attrData[2];

		shadingModel = getPropertyBlock(fbxMaterialData, "ShadingModel:");
		
		Log.d("MG", "HERE: " + shadingModel);
		
		ambientColor = getProperty70ColorRGB(fbxMaterialData, "AmbientColor");
		diffuseColor = getProperty70ColorRGB(fbxMaterialData, "DiffuseColor");
		diffuseFactor = getProperty70Double(fbxMaterialData, "DiffuseFactor");
		transparencyFactor =  getProperty70Double(fbxMaterialData, "TransparencyFactor");
		emissive = getProperty70Vector3D(fbxMaterialData, "Emissive");
		ambient = getProperty70Vector3D(fbxMaterialData, "Ambient");
		diffuse = getProperty70Vector3D(fbxMaterialData, "Diffuse");
		opacity = getProperty70Double(fbxMaterialData, "Opacity");
	}
}
